{% load mytags %}
<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>stuent</title>
	<link href="/static/css/ate2345_student.css" type="text/css" rel="stylesheet">
</head>
<body>
	<div id="student" class="clearfix" style="margin: 0 auto; width:980px;">
		<div></div>
		<div></div>
		<div></div>
		<div></div>
	</div>

	<script src="/static/plugins/jquery-1.11.3/jquery.min.js" type="text/javascript"></script>
	<script>
		$(function(){
		    $.ajax({
                url: '/student/',
                type: 'POST',
                dataType: 'json',  // 注意T要大写
                success: function (arg) {
                    //arg = JSON.parse(arg); // 将字符串转换为对象
                    //arg = JSON.stringify(arg);  // 将对象转换为字符串
                    console.log(arg);
					// 以上arg为所取数据，并转换数据
					// 以下为循环数据对象
					$.each(arg, function(k,v){
					    k = k + 1;
					    var div = document.createElement('div');
							//div.style.width = "245px";
							div.className = 'cls1';

							var img = document.createElement('img');
							img.src = '/' + v.student__pic;

							var p = document.createElement('p');
							p.innerText = v.letter_of_thanks;

							div.appendChild(img);
							div.appendChild(p);
					    if(k%4 == 1){
							$('#student').children(':eq(0)').append(div);
						}else if(k%4 == 2){
							$('#student').children(':eq(1)').append(div);
						}else if(k%4 == 3){
							$('#student').children(':eq(2)').append(div);
						}else if(k%4 == 0 ){
							$('#student').children(':eq(3)').append(div);
						}else{

						}
					})
                }
            })
		})
	</script>
</body>
</html>